package Thread;

import java.util.Scanner;

class MyCounter {
    public static volatile int flog = 0;
}

public class ThreadDemo10 {

    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            while (MyCounter.flog == 0) {

            }
            System.out.println("我终于出来了!!!");
        });
        Thread t2 = new Thread(()->{
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入一个整数:");
            MyCounter.flog = scanner.nextInt();
        });
        t1.start();
        t2.start();
    }

}
